//
//  Akeeta_NetWorking.h
//  yaguan
//
//  Created by Feng on 2019/4/15.
//  Copyright © 2019年 yaguan. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef void (^HttpSuccessBlock)(id responseObject);

typedef void (^HttpFailureBlock)(NSError *error);


@interface Akeeta_NetWorking : NSObject


/**
 Post 请求
 
 @param url         请求地址
 @param params      请求参数
 @param token       token
 @param success     成功block
 @param failure     失败block
 */
+ (NSURLSessionDataTask *)postWithPath:(NSString *_Nullable)url
                                params:(NSDictionary *_Nullable)params
                           clientToken:(NSString *_Nullable)token
                               success:(HttpSuccessBlock)success
                               failure:(HttpFailureBlock)failure;

/**
 Get 请求
 
 @param url         请求地址
 @param params      请求参数
 @param token       token
 @param success     成功block
 @param failure     失败block
 */
+ (NSURLSessionDataTask *)getWithPath:(NSString *_Nullable)url
                               params:(NSDictionary * _Nullable)params
                          clientToken:(NSString *_Nullable)token
                              success:(HttpSuccessBlock)success
                              failure:(HttpFailureBlock)failure;


/// 支持application/x-www-form-urlencoded 的请求
/// @param url 请求地址
/// @param params 请求参数
///@param success     成功block
///@param failure     失败block
+ (NSURLSessionDataTask *)postWithPath:(NSString *_Nullable)url
                                params:(NSDictionary *_Nullable)params
                               success:(HttpSuccessBlock)success
                               failure:(HttpFailureBlock)failure;
@end

NS_ASSUME_NONNULL_END
